package by.grsu.coctails.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import by.grsu.coctails.R;
import by.grsu.coctails.common.utils.ImageManager;
import by.grsu.coctails.model.Coctail;

public class CoctailAdapter extends AbstractAdapter<Coctail> {

	public CoctailAdapter(Context c, int pItemResource, List<Coctail> pList) {
		super(c, pItemResource, pList);
	}

	@Override
	public void init(View convertView, Coctail item) {
		TextView name = (TextView) convertView.findViewById(R.id.name);
		name.setText(item.getName());

		TextView composition = (TextView) convertView
				.findViewById(R.id.composition);

		composition.setText(item.getCompostionString());

		ImageView image = (ImageView) convertView.findViewById(R.id.image);
		getImageLoader().bind(this, image, ImageManager.HTTP + item.getImage());
	}

}
